<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %>
<%@ page contentType="text/html;charset=UTF-8" language="java" %>
<%@taglib prefix="tag" uri="com.sand.myTag" %>
<!DOCTYPE html>
<html>
<head>
    <meta charset="utf-8">
    <title>layui</title>
    <meta name="renderer" content="webkit">
    <meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
    <meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1">
    <link rel="stylesheet" href="${pageContext.request.contextPath}/layui/lib/layui-v2.6.3/css/layui.css" media="all">
    <link rel="stylesheet" href="${pageContext.request.contextPath}/layui/css/public.css" media="all">

</head>
<body>
<div class="layui-form layuimini-form">
    <div class="layui-form-item">
        <label class="layui-form-label">小区名称:</label>
        <div class="layui-input-inline">
            <input type="text" disabled value="${obj.communityName}" class="layui-input">
        </div>
        <label class="layui-form-label">提问姓名:</label>
        <div class="layui-input-inline">
            <input type="text" disabled value="${obj.name}" class="layui-input">
        </div>
    </div>
    <div class="layui-form-item">
        <label class="layui-form-label">回复数量:</label>
        <div class="layui-input-inline">
            <input type="text" disabled value="${obj.replyNumber}" class="layui-input">
        </div>
        <label class="layui-form-label">提问时间:</label>
        <div class="layui-input-inline">
            <input type="text" disabled value="${obj.createTime}" class="layui-input">
        </div>
    </div>
    <div class="layui-form-item">
        <label class="layui-form-label ">提问内容:</label>
        <div class="layui-input-block">
            <input type="text" disabled value="${obj.content}" class="layui-input">
        </div>
    </div>
</div>
<hr style="background-color: green;height: 1px;border: none"/>
<c:forEach items="${list}" var="ite">
    <div class="layui-form layuimini-form">
        <input type="hidden" name="rid" value="${ite.rid}">
        <div class="layui-form-item">
            <label class="layui-form-label">回答用户:</label>
            <div class="layui-input-inline">
                <input type="text" disabled value="${ite.name}" class="layui-input">
            </div>
            <label class="layui-form-label">回答时间:</label>
            <div class="layui-input-inline">
                <input type="text" disabled value="${ite.answerTime}" class="layui-input">
            </div>
            <div class="layui-input-block">
                <button class="layui-btn layui-btn-primary layui-border-red" lay-submit lay-filter="delete">删除回复</button>
            </div>
        </div>
        <div class="layui-form-item">
            <label class="layui-form-label">回答内容:</label>
            <div class="layui-input-block">
                <input type="text" disabled value="${ite.content}" class="layui-input">
            </div>
        </div>
    </div>
    <hr/>
</c:forEach>


<script src="${pageContext.request.contextPath}/layui/lib/layui-v2.6.3/layui.js" charset="utf-8"></script>
<script src="${pageContext.request.contextPath}/layui/js/lay-config.js?v=1.0.4" charset="utf-8"></script>
<script>
    layui.use(['form', 'tableSelect', 'table', 'laydate'], function () {
        var form = layui.form,
            layer = layui.layer,
            tableSelect = layui.tableSelect,
            laydate = layui.laydate,
            $ = layui.$;

        //监听提交
        form.on('submit(delete)', function (data) {
            $.ajax({
                url:"${pageContext.request.contextPath}/question/delQuestionDetails",
                type:"post",
                data:"data="+JSON.stringify(data.field),
                dataType:"text",
                success:(rs)=>{
                    if(rs=="OK"){
                        layer.msg("删除成功",{icon:1,time:500},function (){
                            window.location.href="${pageContext.request.contextPath}/question/queryQuestionById?showWi=1&rid="+${obj.rid};
                        })
                    }else{
                        layer.msg("删除失败",{icon:2,time:500})
                    }
                }
            })
            return false;
        });
    });
</script>
</body>
</html>